package com.leyou.auth.controller;

import com.leyou.auth.dto.AliOssSignatureDTO;
import com.leyou.auth.service.AliAuthService;
import org.springframework.http.HttpHeaders;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/ali")
public class AliAuthController {
    @Resource
    private AliAuthService aliAuthService;

    @GetMapping("/oss/signature")
    public ResponseEntity<AliOssSignatureDTO> getAliSignature(){
//        HttpHeaders headers = new HttpHeaders();
//        headers.set("Access-Control-Allow-Origin","manage.leyou.com");
//        return ResponseEntity.ok().headers(headers).body(aliAuthService.getAliSignature());
        return ResponseEntity.ok(aliAuthService.getAliSignature());
    }

}
